import Vue from 'vue';
import App from './App';
import store from './store/index.js';
Vue.config.productionTip = false

Vue.prototype.$store = store;
//引入全局组件
import divider from './components/common/divider.vue';
Vue.component("divider",divider);
import noThing from './components/common/no-thing.vue';
Vue.component("noThing",noThing);
App.mpType = 'app'

import $configPath from './common/config.js';


Vue.prototype.$configPath = $configPath

import $R from './common/request.js';

Vue.prototype.$R = $R

import $U from './common/until.js';

Vue.prototype.$U = $U

//权限验证
Vue.prototype.checkAuth = ((callback)=>{
	if(!store.state.loginStatus)
	{
     	uni.showToast({
	       title:'请先登录',
		   icon:'none'
     	});
		return uni.navigateTo({
			url:'/pages/login/login'
		});	
	}
	callback()
})

//权限验证跳转
Vue.prototype.navigateTo = ((options)=>{
	if(!store.state.loginStatus)
	{
	 	uni.showToast({
	       title:'请先登录',
		   icon:'none'
	 	});
		return uni.navigateTo({
			url:'/pages/login/login'
		});	
	}
	uni.navigateTo(options)
})


const app = new Vue({
	store,
    ...App
})
app.$mount()
